package cn.iocoder.yudao.module.ym.dal.mysql.worktemp;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.ym.dal.dataobject.worktemp.WorkTempDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.ym.controller.admin.worktemp.vo.*;

/**
 * 工单模板 Mapper
 *
 * @author 韩艳阳
 */
@Mapper
public interface WorkTempMapper extends BaseMapperX<WorkTempDO> {

    default PageResult<WorkTempDO> selectPage(WorkTempPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<WorkTempDO>()
                .eqIfPresent(WorkTempDO::getRemark, reqVO.getRemark())
                .eqIfPresent(WorkTempDO::getDeptId, reqVO.getDeptId())
                .betweenIfPresent(WorkTempDO::getCreateTime, reqVO.getCreateTime())
                .likeIfPresent(WorkTempDO::getTempName, reqVO.getTempName())
                .eqIfPresent(WorkTempDO::getStatus, reqVO.getStatus())
                .eqIfPresent(WorkTempDO::getTempType, reqVO.getTempType())
                .eqIfPresent(WorkTempDO::getTempFiled, reqVO.getTempFiled())
                .eqIfPresent(WorkTempDO::getTempConf, reqVO.getTempConf())
                .eqIfPresent(WorkTempDO::getExample, reqVO.getExample())
                .orderByAsc(WorkTempDO::getId));
    }

    default List<WorkTempDO> selectList(WorkTempPageReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<WorkTempDO>()
                .eqIfPresent(WorkTempDO::getRemark, reqVO.getRemark())
                .eqIfPresent(WorkTempDO::getDeptId, reqVO.getDeptId())
                .betweenIfPresent(WorkTempDO::getCreateTime, reqVO.getCreateTime())
                .likeIfPresent(WorkTempDO::getTempName, reqVO.getTempName())
                .eqIfPresent(WorkTempDO::getStatus, reqVO.getStatus())
                .eqIfPresent(WorkTempDO::getTempType, reqVO.getTempType())
                .eqIfPresent(WorkTempDO::getTempFiled, reqVO.getTempFiled())
                .eqIfPresent(WorkTempDO::getTempConf, reqVO.getTempConf())
                .eqIfPresent(WorkTempDO::getExample, reqVO.getExample())
                .orderByAsc(WorkTempDO::getId));
    }

}
